package com.kpx.app.wigdet;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.kpx.app.R;
import com.kpx.app.activity.ActivityWebShow;
import com.kpx.app.bean.GrowthChildBean2;
import com.kpx.app.utils.uiutils.DisplayUtil;
import com.kpx.app.utils.uiutils.IntentUtil;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by congdy on 17/4/22.
 */

public class ViewShowGrowthChild extends LinearLayout {
    @BindView(R.id.txt_title)
    TextView txtTitle;
    @BindView(R.id.img_pic)
    ImageView img_pic;

    public ViewShowGrowthChild(final Context context, final GrowthChildBean2 growthChildBean) {
        super(context);
        View view = View.inflate(context, R.layout.view_item_show_g_child, this);
        ButterKnife.bind(view);
        txtTitle.setText(growthChildBean.getName());
        DisplayUtil.setViewWH_L_new(context,img_pic,(float)69/30,1,30);
        Glide.with(context).load(growthChildBean.getChildCoverPic()).into(img_pic);
        img_pic.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityWebShow.url = growthChildBean.getChildLinkUrl();
                ActivityWebShow.title = growthChildBean.getName();
                ActivityWebShow.type = 2;
                IntentUtil.gotoActivity(context,ActivityWebShow.class);
            }
        });
    }
}
